home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / gs24src.zip / GXCLIST.H < prev    next >
C/C++ Source or Header  |  1992-02-28  |  4KB  |  89 lines

  1. /* Copyright (C) 1991, 1992 Aladdin Enterprises.  All rights reserved.
  2.    Distributed by Free Software Foundation, Inc.
  3.  
  4. This file is part of Ghostscript.
  5.  
  6. Ghostscript is distributed in the hope that it will be useful, but
  7. WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  8. to anyone for the consequences of using it or for whether it serves any
  9. particular purpose or works at all, unless he says so in writing.  Refer
  10. to the Ghostscript General Public License for full details.
  11.  
  12. Everyone is granted permission to copy, modify and redistribute
  13. Ghostscript, but only under the conditions described in the Ghostscript
  14. General Public License.  A copy of this license is supposed to have been
  15. given to you along with Ghostscript so you can know your rights and
  16. responsibilities.  It should be in a file named COPYING.  Among other
  17. things, the copyright notice and this notice must be preserved on all
  18. copies.  */
  19.  
  20. /* gxclist.h */
  21. /* Command list definitions for Ghostscript. */
  22. /* Requires gxdevice.h and gxdevmem.h */
  23.  
  24. /*
  25.  * A command list is essentially a compressed list of driver calls.
  26.  * Command lists are used to record an image that must be rendered in bands
  27.  * for a high-resolution printer.  In the future, they may be used
  28.  * for other purposes as well, such as providing a more compact representation
  29.  * of cached characters than a full bitmap (at high resolution), or
  30.  * representing fully rendered user paths (a Level 2 feature).
  31.  */
  32.  
  33. /* A command list device outputs commands to a stream, */
  34. /* then reads them back to render in bands. */
  35. typedef struct gx_device_clist_s gx_device_clist;
  36. typedef struct gx_clist_state_s gx_clist_state;
  37. typedef struct {
  38.     int slot_index;
  39. } tile_hash;
  40. typedef struct {
  41.     gx_bitmap_id id;
  42.     /* byte band_mask[]; */
  43.     /* byte bits[]; */
  44. } tile_slot;
  45. struct gx_device_clist_s {
  46.     gx_device_common;        /* (see gxdevice.h) */
  47.     /* Following must be set before writing or reading. */
  48.     gx_device *target;        /* device for which commands */
  49.                     /* are being buffered */
  50.     byte *data;            /* buffer area */
  51.     uint data_size;            /* size of buffer */
  52.     FILE *cfile;            /* command list file */
  53.     FILE *bfile;            /* command list block file */
  54.     /* Following are used only when writing. */
  55.     gx_clist_state *states;        /* current state of each band */
  56.     byte *cbuf;            /* start of command buffer */
  57.     byte *cnext;            /* next slot in command buffer */
  58.     byte *cend;            /* end of command buffer */
  59.     gx_clist_state *ccls;        /* clist_state of last command */
  60.     /* Following is the tile cache, used only when writing. */
  61.     gx_bitmap tile;            /* current tile cache parameters */
  62.                     /* (data pointer & id not used) */
  63.     tile_hash *tile_hash_table;    /* hash table for tile cache: */
  64.                     /* -1 = unused, >= 0 = slot index */
  65.     uint tile_max_size;        /* max size of a single tile */
  66.     uint tile_hash_mask;        /* size of tile hash table -1 */
  67.     uint tile_band_mask_size;    /* size of band mask preceding */
  68.                     /* each tile in the cache */
  69.     uint tile_count;        /* # of occupied entries in cache */
  70.     uint num_tiles;            /* capacity of the cache */
  71.     /* Following are used for both writing and reading. */
  72.     byte *tile_data;        /* data for cached tiles */
  73.     uint tile_data_size;        /* total size of tile cache data */
  74.     uint tile_slot_size;        /* size of each slot in tile cache */
  75. #define tile_slot_ptr(cldev,index)\
  76.   (tile_slot *)((cldev)->tile_data + (index) * (cldev)->tile_slot_size)
  77. #define ts_mask(pts) (byte *)((pts) + 1)
  78. #define ts_bits(cldev,pts) (ts_mask(pts) + (cldev)->tile_band_mask_size)
  79.     /* Following are set when writing, read when reading. */
  80.     int band_height;        /* height of each band */
  81.     int nbands;            /* # of bands */
  82.     long bfile_end_pos;        /* ftell at end of bfile */
  83.     /* Following are used only when reading. */
  84.     int ymin, ymax;            /* current band */
  85.     gx_device_memory mdev;
  86. };
  87. extern gx_device_clist
  88.     gs_clist_device;
  89.